﻿<phone:PhoneApplicationPage 
    x:Class="Coding4Fun.MissionControl.WP.Views.ServerListPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False"
    tkit:TiltEffect.IsTiltEnabled="True"
    xmlns:tkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="100"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0">
            <Grid.Background>
                <ImageBrush ImageSource="/Graphics/headlogo.png" Stretch="None"></ImageBrush>
            </Grid.Background>
        </Grid>

        <phone:Pivot Grid.Row="1" Foreground="Black"
                     SelectionChanged="Pivot_SelectionChanged">
            <phone:PivotItem Header="servers" x:Name="ServersPivot">
                <Grid>
                    <ListBox ItemTemplate="{StaticResource ServerItemTemplate}" ItemsPanel="{StaticResource WrapPanelTemplate}"
                    ItemsSource="{Binding Path=Instance.Servers,Source={StaticResource MainPageViewModel}}"
                    HorizontalAlignment="Center" Margin="0,0,0,12">
                    </ListBox>
                </Grid>
            </phone:PivotItem>

            <phone:PivotItem Header="quick launch" Foreground="Black">
                <Grid>
                    <ListBox x:Name="QuickLaunchList" ItemContainerStyle="{StaticResource ListBoxItemStyle}" Margin="12,0,12,12" SelectionChanged="QuickLaunch_SelectionChanged"
                    ItemsSource="{Binding Path=Instance.Favorites,Source={StaticResource MainPageViewModel}}" ItemTemplate="{StaticResource FavoriteCommandTemplate}">
                    </ListBox>
                </Grid>
            </phone:PivotItem>
        </phone:Pivot>

        <Grid Grid.RowSpan="2" x:Name="grdConnectOverlay" LayoutUpdated="WaitingOverlayLayoutUpdated" Visibility="{Binding Path=Instance.IsWaiting,Source={StaticResource CommonViewModel},Converter={StaticResource BoolToVisibility}}">
            <Grid.Background>
                <SolidColorBrush Opacity=".6" Color="Black"></SolidColorBrush>
            </Grid.Background>

            <StackPanel VerticalAlignment="Center">
                <TextBlock HorizontalAlignment="Center" Margin="24" Text="Attempting to Connect..."></TextBlock>
                <ProgressBar VerticalAlignment="Center" x:Name="perfBar" IsIndeterminate="True"></ProgressBar>
            </StackPanel>
        </Grid>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="btnAddService" Click="btnAddService_Click" IconUri="/Graphics/appbar.add.png" Text="Add server"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="about" x:Name="btnAbout" Click="btnAbout_Click"></shell:ApplicationBarMenuItem>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
